package com.itheima;

import java.io.File;

public class Demo2 {
    public static void main(String[] args) {
        File dir = new File("D:\\FileText");

        File[] file = dir.listFiles();

        for (File file1 : file) {
            if (file1.isFile() && file1.getName().endsWith(".java")) {
                System.out.println(file1.getName());
            }
        }

    }
}
